let set = new Set([1,2,4,4]);

let set1 = new Set((function*(){
    yield 1;
    yield 2;
    yield 2;
    yield [22];
})())

let iterableObj = {
    [Symbol.iterator]:function() {
        let arr = [1,2,3];
        let temp = 0;
        return {
            next:function() {
                if(temp < arr.length) {
                    return {
                        value:arr[temp++],
                        done:false
                    }

                }else {
                    return {
                        value:undefined,
                        done:true
                    }
                }
            }
        }
    }
}

let set2 = new Set(iterableObj);
console.log(set,set1,set2);

console.log([...iterableObj]);